<template>
  <div class="app-bg auto">
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">户号</label>
        <input class="col-xs-4" v-model="model.f_userid" placeholder="请输入用户编号" disabled>
        <label class="col-xs-2 control-label text-left">姓名</label>
        <input class="col-xs-3" v-model="model.f_username" placeholder="请输入用户姓名"  >
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">用户电话</label>
        <input class="col-xs-9" v-model="model.f_phone" placeholder="请输入用户电话"  >
      </div>
      <div class="row app-input" v-show='!usertypestate'>
        <label class="col-xs-3 control-label text-left" >实际姓名</label>
        <input class="col-xs-3" v-model="model.f_newuser_name" placeholder="请输入用户电话">
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">身份证号码</label>
        <input class="col-xs-9" v-model="model.f_identity_id" placeholder="请输入身份证号码" >
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">开户日期</label>
        <input class="col-xs-9" v-model="model.f_dateofopening" placeholder="请输入开户日期" >
      </div>
      <div class="row app-input" style="margin-top: 10px;">
        <label class="col-xs-4 control-label text-left">用户地址</label>
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">地址</label>
        <input class="col-xs-9" v-model="model.f_address" placeholder="请输入用户地址" >
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">新地址</label>
        <span class="col-xs-9  text-left">{{model.f_area}}{{model.f_street}}
          {{model.f_road}}{{model.f_districtname!== 'null' && model.f_districtname !== null?model.f_districtname:''}}
          {{model.f_cusdom!== 'null'&&model.f_cusdom !== null?model.f_cusdom +'楼':''}}
          {{model.f_cusdy!== 'null' && model.f_cusdy !== null?model.f_cusdy+'单元': ''}}
          {{model.f_cusfloor!== 'null'&&model.f_cusfloor !== null?model.f_cusfloor+'层': ''}}
          {{model.f_apartment!== 'null'&&model.f_apartment !== null?model.f_apartment+'号': ''}}
        </span>
      </div>
      <div class="row app-input" >
        <label class="col-xs-3 control-label text-left">区域</label>
        <v-select :value.sync="model.f_area" v-model="model.f_area" class="col-xs-4"
            :options='f_area' placeholder='区域选择' @change="change(false,true,true)"
        close-on-select></v-select>

        <label class="col-xs-2 control-label text-left">路段</label>
        <v-select :value.sync="model.f_street" v-model="model.f_street" class="col-xs-3"
            :options='f_street' placeholder='道路选择' @change="change(false,false,true)"
        close-on-select></v-select>
      </div>
      <div class="row app-input" >
        <label class="col-xs-3 control-label text-left">街道</label>
        <v-select :value.sync="model.f_road" v-model="model.f_road" class="col-xs-3"
            :options='f_road' placeholder='街道选择' close-on-select></v-select>
        <label class="col-xs-3 control-label text-left" v-show='usertypestate'>小区</label>
        <input class="col-xs-3" v-model="model.f_districtname" placeholder="请输入小区"  v-show='usertypestate' >
      </div>
      <div class="row app-input" v-show='usertypestate'>
        <label class="col-xs-3 control-label text-left">楼号</label>
        <input class="col-xs-3" v-model="model.f_cusdom" placeholder="请输入楼号"  >
        <label class="col-xs-3 control-label text-left">单元</label>
        <input class="col-xs-3" v-model="model.f_cusdy" placeholder="请输入单元"  >
      </div>
      <div class="row app-input" >
        <label class="col-xs-3 control-label text-left" v-show='usertypestate'>楼层</label>
        <input class="col-xs-3" v-model="model.f_cusfloor" placeholder="请输入楼层"  v-show='usertypestate'>
        <label class="col-xs-3 control-label text-left">门牌号</label>
        <input class="col-xs-3" v-model="model.f_apartment" placeholder="请输入门牌号"  >
      </div>
      <div class="row app-input" style="margin-top: 10px;">
        <label class="col-xs-4 control-label text-left">表具信息</label>
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">气表品牌</label>
        <v-select :value.sync="model.f_gaswatchbrand" v-model="model.f_gaswatchbrand" class="col-xs-3"
            :options='f_gaswatchbrand' placeholder='气表品牌选择' @change="change(false,model.f_gaswatchbrand[0],false)"
        close-on-select></v-select>
        <label class="col-xs-3 control-label text-left">表封号</label>
        <input class="col-xs-3" v-model="model.f_metertitles" placeholder="请输入表封号"  >
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">表型</label>
        <v-select :value.sync="model.f_metertype" v-model="model.f_metertype"
            :options='f_metertype' placeholder='表型号选择'
        close-on-select></v-select>
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">表号</label>
        <input class="col-xs-3" v-model="model.f_meternumber" placeholder="请输入表号"  >
        <label class="col-xs-3 control-label text-left">用户状态</label>
        <input class="col-xs-3" v-model="model.f_userstate" placeholder="请输入用户状态"  >
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">灶前压力</label>
        <input class="col-xs-3" v-model="model.f_prefocalpressure" placeholder="请输入灶前压力"  >
        <label class="col-xs-3 control-label text-left">总购气量</label>
        <input class="col-xs-3" v-model="model.f_metergasnums" placeholder="请输入总购气量"  >
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left" >表上气量</label>
        <input class="col-xs-3" v-model="model.f_newmetergasnums" placeholder="请输入表气量"  >
        <label class="col-xs-3 control-label text-left" v-show='!usertypestate'>ic累计</label>
        <input class="col-xs-3" v-model="model.f_icnums" placeholder="请输ic累计量"  v-show='!usertypestate'>
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">左右表</label>
        <v-select :value.sync="model.f_aroundmeter" v-model="model.f_aroundmeter" class="col-xs-3"
            :options='f_aroundmeter' placeholder='左右表选择'
        close-on-select></v-select>
        <label class="col-xs-3 control-label text-left" v-show='!usertypestate'>动态气量</label>
        <input class="col-xs-3" v-model="model.f_tregasnum" placeholder="请输入动态气量"  v-show='!usertypestate' >
      </div>
      <div class="row app-input">
        <label class="col-xs-3 control-label text-left">已用气量</label>
        <input class="col-xs-3" v-model="model.f_yigasnum" placeholder="请输入已用气量"  >
        <label class="col-xs-3 control-label text-left">剩余气量</label>
        <input class="col-xs-3" v-model="model.f_wygasnum" placeholder="请输入剩余气量"  >
      </div>

      <div class="row app-input" style="margin-top: 10px;">
        <label class="col-xs-4 control-label text-left">设备信息</label>
      </div>
      <!-- 壁挂炉 -->
      <div class="row app-input" style="margin-top: 10px;" v-show='usertypestate'>
        <label class="col-xs-4 control-label text-left"> 壁挂炉</label>
      </div>
      <div class="row app-input" v-show='usertypestate'>
        <label class="col-xs-3 control-label text-left">吨位</label>
        <input class="col-xs-3" v-model="model.f_wall_hungboile_tonnage" placeholder="输入个数" >
        <label class="col-xs-3 control-label text-left">台数</label>
        <input class="col-xs-3" v-model="model.f_wall_hungboile_quantity" placeholder="输入品牌" >
      </div>
      <div class="row app-input" v-show='usertypestate'>
        <label class="col-xs-3 control-label text-left">品牌</label>
        <input class="col-xs-3" v-model="model.f_wall_hungboile_brand" placeholder="输入个数" >
      </div>

      <!-- 热水器 -->
      <div class="row app-input" style="margin-top: 10px;" v-show='usertypestate'>
        <label class="col-xs-4 control-label text-left"> 热水器</label>
      </div>
      <div class="row app-input" v-show='usertypestate'>
        <label class="col-xs-3 control-label text-left">吨位</label>
        <input class="col-xs-3" v-model="model.f_waterheate_tonnage" placeholder="输入个数" >
        <label class="col-xs-3 control-label text-left">台数</label>
        <input class="col-xs-3" v-model="model.f_waterheate_quantity" placeholder="输入品牌" >
      </div>
      <div class="row app-input" v-show='usertypestate'>
        <label class="col-xs-3 control-label text-left">品牌</label>
        <input class="col-xs-3" v-model="model.f_waterheate_brand" placeholder="输入个数" >
      </div>

      <!-- 家用灶 -->
      <div class="row app-input" style="margin-top: 10px;" v-show='usertypestate'>
        <label class="col-xs-4 control-label text-left"> 灶具</label>
      </div>
      <div class="row app-input" v-show='usertypestate'>
        <label class="col-xs-3 control-label text-left">吨位</label>
        <input class="col-xs-3" v-model="model.f_homekitche_tonnage" placeholder="输入个数" >
        <label class="col-xs-3 control-label text-left">台数</label>
        <input class="col-xs-3" v-model="model.f_homekitche_quantity" placeholder="输入品牌" >
      </div>
      <div class="row app-input" v-show='usertypestate'>
        <label class="col-xs-3 control-label text-left">品牌</label>
        <input class="col-xs-3" v-model="model.f_homekitche_brand" placeholder="输入个数" >
      </div>
      <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
        <label class="col-xs-4 control-label text-left"> 采暖炉</label>
      </div>
      <div class="row app-input" v-show='!usertypestate'>
        <label class="col-xs-3 control-label text-left">吨位</label>
        <input class="col-xs-3" v-model="model.f_heatingboile_tonnage" placeholder="输入个数" >
        <label class="col-xs-3 control-label text-left">台数</label>
        <input class="col-xs-3" v-model="model.f_heatingboile_quantity" placeholder="输入品牌" >
      </div>
      <div class="row app-input" v-show='!usertypestate'>
        <label class="col-xs-3 control-label text-left">品牌</label>
        <input class="col-xs-3" v-model="model.f_heatingboile_brand" placeholder="输入个数" >
      </div>
  <!-- 茶水炉 -->
  <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
    <label class="col-xs-4 control-label text-left"> 茶水炉</label>
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">吨位</label>
    <input class="col-xs-3" v-model="model.f_teaboile_tonnage" placeholder="输入个数" >
    <label class="col-xs-3 control-label text-left">台数</label>
    <input class="col-xs-3" v-model="model.f_teaboile_quantity" placeholder="输入品牌" >
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">品牌</label>
    <input class="col-xs-3" v-model="model.f_teaboile_brand" placeholder="输入个数" >
  </div>
  <!--模块炉  -->
  <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
    <label class="col-xs-4 control-label text-left"> 模块炉</label>
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">吨位</label>
    <input class="col-xs-3" v-model="model.f_moduleboile_tonnage" placeholder="输入个数" >
    <label class="col-xs-3 control-label text-left">台数</label>
    <input class="col-xs-3" v-model="model.f_moduleboile_quantity" placeholder="输入品牌" >
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">品牌</label>
    <input class="col-xs-3" v-model="model.f_moduleboile_brand" placeholder="输入个数" >
  </div>

  <!-- 壁挂炉 -->
  <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
    <label class="col-xs-4 control-label text-left"> 壁挂炉</label>
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">吨位</label>
    <input class="col-xs-3" v-model="model.f_wall_hungboile_tonnage" placeholder="输入个数" >
    <label class="col-xs-3 control-label text-left">台数</label>
    <input class="col-xs-3" v-model="model.f_wall_hungboile_quantity" placeholder="输入品牌" >
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">品牌</label>
    <input class="col-xs-3" v-model="model.f_wall_hungboile_brand" placeholder="输入个数" >
  </div>

  <!-- 热水器 -->
  <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
    <label class="col-xs-4 control-label text-left"> 热水器</label>
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">吨位</label>
    <input class="col-xs-3" v-model="model.f_waterheate_tonnage" placeholder="输入个数" >
    <label class="col-xs-3 control-label text-left">台数</label>
    <input class="col-xs-3" v-model="model.f_waterheate_quantity" placeholder="输入品牌" >
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">品牌</label>
    <input class="col-xs-3" v-model="model.f_waterheate_brand" placeholder="输入个数" >
  </div>

  <!-- 家用灶 -->
  <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
    <label class="col-xs-4 control-label text-left"> 家用灶</label>
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">吨位</label>
    <input class="col-xs-3" v-model="model.f_homekitche_tonnage" placeholder="输入个数" >
    <label class="col-xs-3 control-label text-left">台数</label>
    <input class="col-xs-3" v-model="model.f_homekitche_quantity" placeholder="输入品牌" >
  </div>
  <div class="row app-input" v-show='!usertypestate'>
    <label class="col-xs-3 control-label text-left">品牌</label>
    <input class="col-xs-3" v-model="model.f_homekitche_brand" placeholder="输入个数" >
  </div>

      <!-- 火眼 -->
      <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
        <label class="col-xs-4 control-label text-left"> 火眼</label>
      </div>
      <div class="row app-input" v-show='!usertypestate'>
        <label class="col-xs-3 control-label text-left">个数</label>
        <input class="col-xs-3" v-model="model.f_fierey_quantity" placeholder="输入个数" >
        <label class="col-xs-3 control-label text-left">品牌</label>
        <input class="col-xs-3" v-model="model.f_fierey_brand" placeholder="输入品牌" >*
      </div>
      <!--蒸车  -->
      <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
        <label class="col-xs-4 control-label text-left"> 蒸车</label>
      </div>
      <div class="row app-input" v-show='!usertypestate'>
        <label class="col-xs-3 control-label text-left">个数</label>
        <input class="col-xs-3" v-model="model.f_steamcar_quantity" placeholder="输入个数" >
        <label class="col-xs-3 control-label text-left">品牌</label>
        <input class="col-xs-3" v-model="model.f_steamcar_brand" placeholder="输入品牌" >
      </div>
      <!-- 小火眼 -->
      <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
        <label class="col-xs-4 control-label text-left"> 小火眼</label>
      </div>
      <div class="row app-input" v-show='!usertypestate'>
        <label class="col-xs-3 control-label text-left">个数</label>
        <input class="col-xs-3" v-model="model.f_smallfireey_quantity" placeholder="输入个数" >
        <label class="col-xs-3 control-label text-left">品牌</label>
        <input class="col-xs-3" v-model="model.f_smallfireey_brand" placeholder="输入品牌" >
      </div>
      <!--调压箱  -->
      <div class="row app-input" style="margin-top: 10px;" v-show='!usertypestate'>
        <label class="col-xs-4 control-label text-left"> 调压箱</label>
      </div>
      <div class="row app-input" v-show='!usertypestate'>
        <label class="col-xs-3 control-label text-left">安装位置</label>
        <input class="col-xs-3" v-model="model.f_prerbox" placeholder="请输入安装位置" >
        <label class="col-xs-3 control-label text-left">品牌</label>
        <input class="col-xs-3" v-model="model.f_prerboxbrand" placeholder="请输入品牌" >
      </div>
      <div class="row app-input" v-show='!usertypestate'>
        <label class="col-xs-3 control-label text-left">型号</label>
        <input class="col-xs-3" v-model="model.f_prerboxtype" placeholder="请输入型号" >
        <label class="col-xs-3 control-label text-left">数量</label>
        <input class="col-xs-3" v-model="model.f_prerboxnum" placeholder="请输入数量" >
      </div>

      <div class="row app-input" style="margin-top: 10px;">
        <label class="col-xs-4 control-label text-left"> 用户意见</label>
      </div>
      <div class="row app-input">
          <textarea v-model="model.f_opinion" class="form-control" id="div"
           style="width:100%;height:50%;font-size:1.5em;" placeholder='意见'></textarea>
      </div>
      <div class="row app-input" style="margin-top: 10px;">
        <label class="col-xs-4 control-label text-left"> 备注</label>
      </div>
      <div class="row app-input">
          <textarea v-model="model.f_mark" class="form-control" id="div"
           style="width:100%;height:50%;font-size:1.5em;" placeholder='备注'></textarea>
      </div>

  </div>
</template>

<script>
import co from 'co'
import Vue from 'vue'
export default {
  title: '用气情况&勇气设备登记',
  props: {
    user: {
      type: Object,
      Default:{}
    }
  },
  data() {
    return {
      model: {
        f_aroundmeter_state: '0',
        f_pregas: 0,
        f_yigasnum: 0,
        f_wygasnum: 0,
        f_newmetergasnums: 0,
        f_newuser_name: '',
        f_metertype: [],
        f_wallhangboile : 0,
        f_wall_hungboile_brand: '',
        f_wall_hungboile_quantity : '',
        f_wall_hungboile_tonnage: '',
        f_waterheate: 0,
        f_waterheate_brand : '',
        f_waterheate_quantity : '',
        f_waterheate_tonnage: '',
        f_heatingboile: 0,
        f_heatingboile_brand : '',
        f_heatingboile_quantity: '',
        f_heatingboile_tonnage: '',
        f_teaboile : 0,
        f_teaboile_brand : '',
        f_teaboile_quantity : '',
        f_teaboile_tonnage : '',
        f_moduleboile : 0,
        f_moduleboile_brand : '',
        f_moduleboile_quantity: '',
        f_moduleboile_tonnage: '',
        f_homekitche : 0,
        f_homekitche_brand : '',
        f_homekitche_quantity: '',
        f_homekitche_tonnage : '',
        f_fierey : 0,
        f_fierey_brand : '',
        f_fierey_quantity : '',
        f_steamcar : 0,
        f_steamcar_brand: '',
        f_steamcar_quantity : '',
        f_smallfireey: 0,
        f_smallfireey_brand : '',
        f_smallfireey_quantity: ''
      },
      usertypestate: false,
      f_area:[],
      f_street: [{label:'全部',value: ''}],
      f_road: [{label:'全部',value: ''}],
      //表选择
      f_gaswatchbrand: [{label: '全部', value: ''}],
      // //表型号
      f_metertype: [{label: '全部', value: ''}]
    }
  },
  computed: {
    f_aroundmeter () {
      return this.$getParams('左右表', [{label: '全部', value: ''}])
    }
  },
  watch:{
    'model.f_yigasnum' (val) {
      console.log(1111111)
      this.model.f_newmetergasnums = parseInt(this.model.f_wygasnum) + parseInt(val)
    },
    'model.f_wygasnum' (val) {
      console.log(1111111)
      this.model.f_newmetergasnums = parseInt(this.model.f_yigasnum) + parseInt(val)
    },
    user:{
        handler:function (val,oldVal) {
            this.model = Object.assign({}, this.model, this.user)
            this.model.f_identity_id = this.model.f_idnumber
            this.model.f_area = (this.model.f_area&&this.model.f_area!=='null'&& this.model.f_area!==null ) ?[this.model.f_area]:['']
            this.model.f_street = (this.model.f_street&&this.model.f_street!=='null'&& this.model.f_street!==null) ?[this.model.f_street]:['']
            this.model.f_road = (this.model.f_road&&this.model.f_road!=='null'&& this.model.f_road!==null) ?[this.model.f_road]:['']
            this.model.f_gaswatchbrand = (this.model.f_gaswatchbrand&&this.model.f_gaswatchbrand!=='null'&& this.model.f_gaswatchbrand!==null) ?[this.model.f_gaswatchbrand]:['']
            this.model.f_metertype = (this.model.f_metertype&&this.model.f_metertype!=='null'&& this.model.f_metertype!==null) ?[this.model.f_metertype]:['']
            this.model.f_aroundmeter = (this.model.f_aroundmeter&&this.model.f_aroundmeter!=='null'&& this.model.f_aroundmeter!==null) ?[this.model.f_aroundmeter]:['']
            this.f_metertype = [{label:this.model.f_metertype[0],value:this.model.f_metertype[0]}]
            //同步档案的设备信息
            this.model.f_heatingboile_brand = this.model.f_heatingboiler_brand
            this.model.f_heatingboile_quantity = this.model.f_heatingboiler_quantity
            this.model.f_heatingboile_tonnage = this.model.f_heatingboiler_tonnage
            this.model.f_teaboile_brand = this.model.f_teaboiler_brand
            this.model.f_teaboile_quantity = this.model.f_teaboiler_quantity
            this.model.f_teaboile_tonnage = this.model.f_teaboiler_tonnage
            this.model.f_moduleboile_brand = this.model.f_moduleboiler_brand
            this.model.f_moduleboile_quantity = this.model.f_moduleboiler_quantity
            this.model.f_moduleboile_tonnage = this.model.f_moduleboiler_tonnage
            this.model.f_fierey_brand = this.model.f_fiereye_brand
            this.model.f_fierey_quantity = this.model.f_fiereye_quantity
            this.model.f_steamcar_brand = this.model.f_steamcars_brand
            this.model.f_steamcar_quantity = this.model.f_steamcars_quantity
            this.model.f_smallfireey_brand = this.model.f_smallfireeye_brand
            this.model.f_smallfireey_quantity = this.model.f_smallfireeye_quantity
            if (val.f_usertype === '非民用') {
              console.log('非民用');
              this.model.f_wall_hungboile_brand = this.model.f_wall_hungboiler_brand
              this.model.f_wall_hungboile_quantity = this.model.f_wall_hungboiler_quantity
              this.model.f_wall_hungboile_tonnage = this.model.f_wall_hungboile_tonnage
              this.model.f_waterheate_brand = this.model.f_waterheater_brand
              this.model.f_waterheate_quantity = this.model.f_waterheater_quantity
              this.model.f_waterheate_tonnage = this.model.f_waterheater_tonnage
              this.model.f_homekitche_brand = this.model.f_homekitchen_brand
              this.model.f_homekitche_quantity = this.model.f_homekitchen_quantity
              this.model.f_homekitche_tonnage = this.model.f_homekitchen_tonnage
              this.usertypestate = false
            } else {
              console.log('民用');
              this.model.f_wall_hungboile_brand = this.model.f_wallhangboilerbrand
              this.model.f_waterheate_brand = this.model.f_waterheaterbrand
              this.model.f_homekitche_brand = this.model.f_kitchenbrand
              this.usertypestate =true
            }
        },
        deep:true
    },
    'model.f_usertype' (val) {
      if (val === '非民用') {
        this.usertypestate = false
      } else {
        this.usertypestate =true
      }
    }
},
methods: {
  change(flag,param,sign) {
    if (flag) {
      this.$post( Vue.url +'sql/params',{data: {key: 'f_area',condition: `1=1`,tablename:`t_area`}},{ resolveMsg: null, rejectMsg: null })
      // this.$post( 'rs/sql/params',{data: {key: 'f_area',condition: `1=1`,tablename:`t_area`}},{ resolveMsg: null, rejectMsg: null })
      .then((res)=>{
        this.f_area = res.data
          this.$post(Vue.url +'sql/ppparams',{data: {key: 'f_pinpai',condition: `1=1`,tablename:`t_qibiao`}},{ resolveMsg: null, rejectMsg: null })
          // this.$post('rs/sql/ppparams',{data: {key: 'f_pinpai',condition: `1=1`,tablename:`t_qibiao`}},{ resolveMsg: null, rejectMsg: null })
        .then((res)=>{
          this.f_gaswatchbrand = res.data
        })
      })

    } else {
      if (sign) {
        if (param) {
          this.$post( Vue.url +'sql/params',{data: {key: 'f_street',condition: `f_area = '${this.model.f_area[0]}'`,tablename:`t_area`}},{ resolveMsg: null, rejectMsg: null })
          // this.$post( 'rs/sql/params',{data: {key: 'f_street',condition: `f_area = '${this.model.f_area[0]}'`,tablename:`t_area`}},{ resolveMsg: null, rejectMsg: null })
          .then((res)=>{
            this.f_street = res.data
          })
        }else {
          this.$post( Vue.url +'sql/params',{data: {key: 'f_area_address',condition: `f_street = '${this.model.f_street[0]}'`,tablename:`t_area`}},{ resolveMsg: null, rejectMsg: null })
          // this.$post('rs/sql/params',{data: {key: 'f_area_address',condition: `f_street = '${this.model.f_street[0]}'`,tablename:`t_area`}},{ resolveMsg: null, rejectMsg: null })
          .then((res)=>{
            this.f_road = res.data
          })
        }
      }else {
        for (var i = 0; i < this.f_gaswatchbrand.length; i++) {
          if (param === this.f_gaswatchbrand[i].value) {
            this.$post(Vue.url +'sql/params',{data: {key: 'f_qbnumber',condition: `1=1 and parentid='${this.f_gaswatchbrand[i].id}'`,tablename:`t_qbnumber`}},{ resolveMsg: null, rejectMsg: null })
            // this.$post('rs/sql/params',{data: {key: 'f_qbnumber',condition: `1=1 and parentid='${this.f_gaswatchbrand[i].id}'`,tablename:`t_qbnumber`}},{ resolveMsg: null, rejectMsg: null })
          .then((res)=>{
            this.f_metertype = res.data
          })
          }
        }
      }

    }
}
},
  ready() {
    this.model = Object.assign({}, this.model, this.user)
    this.model.f_identity_id = this.model.f_idnumber
    this.model.f_area = (this.model.f_area&&this.model.f_area!=='null'&& this.model.f_area!==null ) ?[this.model.f_area]:['']
    this.model.f_street = (this.model.f_street&&this.model.f_street!=='null'&& this.model.f_street!==null) ?[this.model.f_street]:['']
    this.model.f_road = (this.model.f_road&&this.model.f_road!=='null'&& this.model.f_road!==null) ?[this.model.f_road]:['']
    this.model.f_gaswatchbrand = (this.model.f_gaswatchbrand&&this.model.f_gaswatchbrand!=='null'&& this.model.f_gaswatchbrand!==null) ?[this.model.f_gaswatchbrand]:['']
    this.model.f_metertype = (this.model.f_metertype&&this.model.f_metertype!=='null'&& this.model.f_metertype!==null) ?[this.model.f_metertype]:['']
    this.model.f_aroundmeter = (this.model.f_aroundmeter&&this.model.f_aroundmeter!=='null'&& this.model.f_aroundmeter!==null) ?[this.model.f_aroundmeter]:['']
    this.f_metertype = [{label:this.model.f_metertype[0],value:this.model.f_metertype[0]}]

    this.model.f_heatingboile_brand = this.model.f_heatingboiler_brand
    this.model.f_heatingboile_quantity = this.model.f_heatingboiler_quantity
    this.model.f_heatingboile_tonnage = this.model.f_heatingboiler_tonnage
    this.model.f_teaboile_brand = this.model.f_teaboiler_brand
    this.model.f_teaboile_quantity = this.model.f_teaboiler_quantity
    this.model.f_teaboile_tonnage = this.model.f_teaboiler_tonnage
    this.model.f_moduleboile_brand = this.model.f_moduleboiler_brand
    this.model.f_moduleboile_quantity = this.model.f_moduleboiler_quantity
    this.model.f_moduleboile_tonnage = this.model.f_moduleboiler_tonnage
    this.model.f_fierey_brand = this.model.f_fiereye_brand
    this.model.f_fierey_quantity = this.model.f_fiereye_quantity
    this.model.f_steamcar_brand = this.model.f_steamcars_brand
    this.model.f_steamcar_quantity = this.model.f_steamcars_quantity
    this.model.f_smallfireey_brand = this.model.f_smallfireeye_brand
    this.model.f_smallfireey_quantity = this.model.f_smallfireeye_quantity
    if (this.model.f_usertype === '非民用') {
      console.log('非民用');
      this.model.f_wall_hungboile_brand = this.model.f_wall_hungboiler_brand
      this.model.f_wall_hungboile_quantity = this.model.f_wall_hungboiler_quantity
      this.model.f_wall_hungboile_tonnage = this.model.f_wall_hungboile_tonnage
      this.model.f_waterheate_brand = this.model.f_waterheater_brand
      this.model.f_waterheate_quantity = this.model.f_waterheater_quantity
      this.model.f_waterheate_tonnage = this.model.f_waterheater_tonnage
      this.model.f_homekitche_brand = this.model.f_homekitchen_brand
      this.model.f_homekitche_quantity = this.model.f_homekitchen_quantity
      this.model.f_homekitche_tonnage = this.model.f_homekitchen_tonnage
      this.usertypestate = false
    } else {
      console.log('民用');
      this.model.f_wall_hungboile_brand = this.model.f_wallhangboilerbrand
      this.model.f_waterheate_brand = this.model.f_waterheaterbrand
      this.model.f_homekitche_brand = this.model.f_kitchenbrand
      this.usertypestate =true
    }
    this.change(true)
  }
}
</script>

<style lang="css">
</style>
